using System;
using System.Collections.Generic;
using System.Text;
using EYDIngenieria.ERP.ObjetosDeNegocio.Dominio;
using Castle.ActiveRecord;
using NHibernate.Expression;
using Castle.ActiveRecord.Queries;

namespace EYDIngenieria.ERP.ObjetosDeNegocio.Repositorio
{
   public class RepositorioVoucher
    {
        public void Agregar(Voucher u)
        {
           u.Create();
        }

        public Voucher[] Listar()
        {
           return ActiveRecordBase<Voucher>.FindAll();
        }

        public void Modificar(Voucher u)
        {
            u.UpdateAndFlush();
        }

        public void Eliminar(Voucher u)
        {
            u.DeleteAndFlush();
        }

       public Voucher[] Buscar(string IdVoucher)
       {
           return Voucher.FindAllByProperty("IdVoucher", "IdVoucher", IdVoucher);
       }

       public Voucher Obtener(int id)
       {
           return Voucher.Find(id);
       }
    }
}
